#!/bin/sh
# Source tutorial run functions
#. $WM_PROJECT_DIR/bin/tools/RunFunctions

decomposePar -force

sed -i 's/\(startFrom \).*;/\1    startTime;/g' system/controlDict
sed -i 's/\(startTime \).*;/\1    0;/g' system/controlDict
sed -i 's/\(endTime \).*;/\1    50;/g' system/controlDict
sed -i 's/\(stopAt \).*;/\1    endTime;/g' system/controlDict
sed -i 's/\(writeInterval \).*;/\1    50;/g' system/controlDict
sed -i 's/\(deltaT \).*;/\1   1;/g' system/controlDict
sed -i 's/\(turbulence \).*;/\1    off;/g' constant/RASProperties
sed -i 's/\(application \).*;/\1    rhoSimpleFoam;/g' system/controlDict

sed -i 's/\(p  \).*;/\1    0.15;/g' system/fvSolution
sed -i 's/\(U  \).*;/\1    0.5;/g' system/fvSolution
sed -i 's/\(rho  \).*;/\1    0.05;/g' system/fvSolution
sed -i 's/\(h  \).*;/\1    0.15;/g' system/fvSolution
sed -i 's/\(k  \).*;/\1    0.00;/g' system/fvSolution
sed -i 's/\(epsilon  \).*;/\1    0.00;/g' system/fvSolution

mpirun -np 8 rhoSimpleFoam -parallel > log.lam & pyFoamPlotWatcher.py log.lam
